#ifndef _PTGUI_TYPEDEF_H_
#define _PTGUI_TYPEDEF_H_

typedef rt_uint32_t ptgui_size_t;

#ifdef _MSC_VER
#define ptgui_inline __inline
#else
#define ptgui_inline static inline
#endif

#ifndef FALSE
#define FALSE 0
#endif
#ifndef TRUE
#define TRUE 1
#endif

#ifdef  __cplusplus
#define NULL 					0
#else
#define NULL 					((void *)0)
#endif

#define PTGUI_ALIGN_SIZE			4
#define PTGUI_ALIGN(size, align)	(((size) + (align) - 1) & ~((align)-1))
#define PTGUI_ASSERT(cond)			do { if (!(cond)) ptgui_assert(__FILE__, __LINE__); } while(0)

#define PTGUI_TRUE (TRUE)
#define PTGUI_FALSE (FALSE)

#define PTGUI_FAIL -1
#define PTGUI_SUCC 1
#define PTGUI_IS_SUCC(ret) (ret >= 0 ? PTGUI_TRUE : PTGUI_FALSE)
#define PTGUI_IS_FAIL(ret) (ret < 0 ? PTGUI_TRUE : PTGUI_FALSE)

#ifndef PTGUI_UNUSED_ARG
#define PTGUI_UNUSED_ARG(arg) (void)arg
#endif

#ifndef	 PTGUI_OFFSETOF
#define PTGUI_OFFSETOF(type, member) ((ptgui_size_t) &((type *)0)->member)
#define PTGIO_CONTAINER_OF(ptr, type, member) ((type *)( (char *)(ptr) - PTGUI_OFFSETOF(type,member)))
#endif

#ifdef  __cplusplus
}
#endif	/* __cplusplus */

#endif	/* _PTGUI_CONFIG_H_ */
